import { IOptionType } from './types'
export const useFormEdit = ({ data }: { data: IOptionType }): IItemArray[] => {
  return [
    {
      name: 'parentId',
      label: '选择所属菜单',
      type: 'TreeSelect',
      option: [{ label: '---顶层菜单---', value: 0 }, ...data],
      rules: [
        {
          required: true,
          message: '请选择所属菜单',
        },
      ],
      config: {
        placeholder: '请选择所属菜单',
      },
    },
    {
      name: 'name',
      label: '路由名称',
      type: 'Input',
      placeholder: '请输入路由名称',
      rules: [{ required: true, message: '请输入路由名称' }],
      config: {
        showCount: true,
        maxLength: 20,
      },
    },
    {
      name: 'path',
      label: '路由地址',
      type: 'Input',
      placeholder: '示例：devicecenter 无需加 / ',
      rules: [{ required: true, message: '请输入路由地址' }],
    },
    {
      name: 'sorted',
      label: '排序',
      type: 'InputNumber',
      placeholder: '请输入序号',
      rules: [{ required: true, message: '请输入序号' }],
      config: {
        min: 1,
        max: 100,
      },
    },
    {
      name: 'fullPath',
      label: '路由全路径',
      type: 'Input',
      placeholder: '请输入路由全路径',
      rules: [{ required: true, message: '请输入路由全路径' }],
    },
    {
      name: 'resourcePath',
      label: '前端页面地址',
      type: 'Input',
      placeholder: '⚠️：如果当前为父级菜单禁止填写该内容',
    },
    {
      name: 'icon',
      label: '图标名称',
      type: 'Input',
      placeholder: '请输入图标名称',
    },
    {
      name: 'type',
      label: '类型',
      option: [
        { label: '菜单', value: 'MENU' },
        { label: '路由', value: 'ROUTE' },
      ],
      type: 'Radio',
    },
  ]
}
export const useFormFuncEdit = ({ data }: { data: IOptionType }): IItemArray[] => {
  return [
    {
      name: 'parentId',
      label: '选择所属菜单',
      type: 'TreeSelect',
      option: data,
      rules: [
        {
          required: true,
          message: '请选择所属菜单',
        },
      ],
      config: {
        placeholder: '请选择所属菜单',
      },
    },
    {
      name: 'name',
      label: '功能名称',
      type: 'Input',
      placeholder: '请输入功能名称',
      rules: [{ required: true, message: '请输入功能名称' }],
      config: {
        showCount: true,
        maxLength: 20,
      },
    },
    {
      name: 'interfaceUrl',
      label: '功能地址',
      type: 'Input',
      placeholder: '请输入功能地址',
    },
    {
      name: 'buttonCode',
      label: '按钮编码',
      type: 'Input',
      placeholder: '请输入按钮编码',
    },
  ]
}
